package com.financing.platform.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.financing.platform.dao.IPaymentDao;
import com.financing.platform.dto.FpPaymentDTO;
import com.financing.platform.util.SqlName;


@Repository("paymentDaoImpl")
public class PaymentDaoImpl extends BaseDaoImpl implements IPaymentDao {


	@Override
	public int insertPayment(FpPaymentDTO paymentDTO) throws SQLException {
		return (Integer)this.sqlMapClient.insert(SqlName.PaymentSql.addPayment, paymentDTO);
	}

	@Override
	public FpPaymentDTO loadByOrderId(Map<String,String> map) throws SQLException {
		return (FpPaymentDTO)this.sqlMapClient.queryForObject(SqlName.PaymentSql.queryPayment, map);
	}

	@Override
	public void updatePayment(FpPaymentDTO paymentUp) throws SQLException {
		this.sqlMapClient.update(SqlName.PaymentSql.updatePayment, paymentUp);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<FpPaymentDTO> queryPaymentList(FpPaymentDTO paymentUp)
			throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.PaymentSql.queryPaymentList, paymentUp);
	}
	
	@Override
	public int queryPaymentListCount(FpPaymentDTO paymentDTO) throws SQLException {
		return (Integer)this.sqlMapClient.queryForObject(SqlName.PaymentSql.queryPaymentListCount, paymentDTO);
	}

	@Override
	public int addPayment(FpPaymentDTO paymentDTO) throws SQLException {
		return (Integer)this.sqlMapClient.insert(SqlName.PaymentSql.addPayment, paymentDTO);
	}
}
